package com.uzai.console.service.tb.tborder.impl;

import com.uzai.common.enums.TbOrderTypeEnum;
import com.uzai.console.service.tb.tborder.TbOrderTypeService;
import com.uzai.console.vo.tb.tborder.TbOrderTypeVo;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 淘宝订单类型
 * @author liuqi
 * @date 2021年08月19日 16:50
 */
@Service
public class TbOrderTypeServiceImpl implements TbOrderTypeService {

    /**
     * 查询淘宝订单类型列表(过滤饿了么类型)
     * @author liuqi
     * @date 2021/8/19 16:51
     * @return java.util.List<com.uzai.console.vo.order.OrderStatusVo>
     */
    public List<TbOrderTypeVo> findTbOrderTypeList(){
        //新建返回集合
        List<TbOrderTypeVo> tbOrderTypeVoList = new ArrayList<>();
        TbOrderTypeEnum[] tbOrderTypeEnumArr = TbOrderTypeEnum.values();
        if(tbOrderTypeEnumArr != null && tbOrderTypeEnumArr.length > 0){
            for (TbOrderTypeEnum tbOrderTypeEnum : tbOrderTypeEnumArr) {
                if(tbOrderTypeEnum.getValue().intValue() != TbOrderTypeEnum.FREE.getValue()
                    && tbOrderTypeEnum.getValue().intValue() != TbOrderTypeEnum.ELM.getValue()){ //过滤 免单和饿了么 类型
                    TbOrderTypeVo tbOrderTypeVo = new TbOrderTypeVo();
                    tbOrderTypeVo.setKey(String.valueOf(tbOrderTypeEnum.getValue()));
                    tbOrderTypeVo.setValue(tbOrderTypeEnum.getDesc());
                    tbOrderTypeVoList.add(tbOrderTypeVo);
                }
            }
        }
        return tbOrderTypeVoList;
    }

}
